﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using ClassModel;
using System.Data.SqlClient;

namespace ClassDAL
{

    public class t_class_contact_DAL
    {
        /// <summary>
        /// 添加联系人信息
        /// </summary>
        /// <param name="contact"></param>
        /// <returns></returns>
        public static int InsertContact(t_class_contact contact)
        {
            string insertSQL = "INSERT INTO t_class_contact VALUES (@location,@schoolName,@linkMan,@phoneNum,@createtime);SELECT @@IDENTITY;";

            SqlParameter[] insertParams = new SqlParameter[] 
            {
                new SqlParameter("@location",contact.location),
                new SqlParameter("@schoolName",contact.schoolName),
                new SqlParameter("@linkMan",contact.linkMan),
                new SqlParameter("@phoneNum",contact.phoneNum),
                new SqlParameter("@createtime",contact.createtime)
            };
            

            return Convert.ToInt32(SQLHelper.ExecuteScalar(SQLHelper.GetConnection(), System.Data.CommandType.Text, insertSQL, insertParams));
        }
    }
}
